/*
 *   This file is part of <open-parametrics>
 *   Copyright (c) 2006-2008 Miguel-Angel Sicilia
 *
 *   open-parametrics is free software: you can redistribute it and/or modify
 *   it under the terms of the Lesser GNU General Public License as
 *   published by the Free Software Foundation, either version 3 of
 *   the License, or (at your option) any later version.
 *
 *   open-parametrics is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with open-parametrics.  If not, see <http://www.gnu.org/licenses/>.
 */

package es.uah.cc.ie.parametrics;

import java.util.Collection;
import java.util.HashMap;
import java.util.List;

/**
 * Defines the basic interface for a cost-estimating relationship (CER).
 *
 * According to the Parametric Estimating Handbook:<br>
 * "Defined, a parametric cost estimate is one that uses Cost Estimating
 * Relationships (CERs) and associated mathematical algorithms (or logic)
 * to establish cost estimates".
 * <br> See: <a href="http://cost.jsc.nasa.gov/pcehg.html"> the PEH guide.</a>
 * 
 * 
 * @author Miguel-Angel Sicilia
 */
public abstract class CostEstimatingRelationship {

    /** 
     * The cost drivers used in the CER.
     */
    private HashMap<String, CostDriver> _costdrivers;

    /**
     * The label of the CER.
     */
    private String  _label;


    /**
     * Constructs the CER.
     */
    public CostEstimatingRelationship(){
        _label = "nonamed";
        _costdrivers = new HashMap<String, CostDriver>();
    }

    /**
     * Constructs the CER.
     */
    public CostEstimatingRelationship(String label){
        _label = label;
        _costdrivers = new HashMap<String, CostDriver>();
    }

    /**
     * Gets the label of the CER.
     */
    public String getLabel(){
        return _label;
    }

    /**
     * Gets the collection of cost drivers used in the CER.
     */
    public Collection<CostDriver> getCostDrivers(){
        return _costdrivers.values();
    }

    /**
     * Adds a cost driver to the CER.
     */
    public void addCostDriver(CostDriver c){
        _costdrivers.put(c.getLabel(), c);
    }

    /**
     * Gets the estimation for a given case.
     */
    public abstract double estimate(List<CostDriverValue> instance);


}
